package material.iteratorAndComponent.iteratorAndComponent;

import java.util.Iterator;

/**
 * MenuComponent对每个方法都提供默认的实现
 * 因为有些方法对菜单有意义，而有些只对菜单有意义，默认实现是抛出UnsupportedOperationException
 * 这样的话如果菜单项或者菜单不支持某个操作，他们就不需要做任何事情，直接继承默认实现就好
 */
public abstract class MenuComponent {
    public void add(MenuComponent menuComponent) {
        throw new UnsupportedOperationException();
    }

    public void remove(MenuComponent menuComponent) {
        throw new UnsupportedOperationException();
    }

    public MenuComponent getChild(int i) {
        throw new UnsupportedOperationException();
    }

    public String getName() {
        throw new UnsupportedOperationException();
    }

    public String getDescription() {
        throw new UnsupportedOperationException();
    }

    public boolean isVegetarian() {
        throw new UnsupportedOperationException();
    }

    public double getPrice() {
        throw new UnsupportedOperationException();
    }

    public void print() {
        throw new UnsupportedOperationException();
    }

    public Iterator createIterator() {
        throw new UnsupportedOperationException();
    }

}
